package com.lyfei.yd.domain.bo;

import com.lyfei.yd.domain.dto.SkuInfoDto;
import com.lyfei.yd.domain.entity.Sku;
import lombok.Getter;
import lombok.Setter;

import java.math.BigDecimal;

@Getter
@Setter
public class SkuOrderBo {
    private BigDecimal actualPrice;
    private Integer count;
    private Long categoryId;

    public SkuOrderBo(Sku sku, SkuInfoDto skuInfoDto) {
        this.actualPrice = sku.getPrice();
        this.count = skuInfoDto.getCount();
        this.categoryId = sku.getCategoryId();
    }

    public BigDecimal getTotalPrice() {
        return this.actualPrice.multiply(new BigDecimal(this.count));
    }
}
